package com.example.democommon.domain;

import com.example.democommon.domain.user.User;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Auther Created by l.wang on 2019/2/27.
 */
public interface InternalUser {


    /**
     * 两个问题要注意
     * 1、不支持 @GetMapping等注解
     * 2、@RequestParam("id") 不能缺少("id")
     * @param id
     * @return
     */
    @RequestMapping(value = "/feign/getUser",method = RequestMethod.GET,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    String getUser(@RequestParam("id") String id);

    @RequestMapping(value = "/feign/getUsers",method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,produces = MediaType.APPLICATION_JSON_VALUE)
    List<User> getUsers(@RequestBody User user);

    @RequestMapping(value = "/feign/getUserList",method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,produces = MediaType.APPLICATION_JSON_VALUE)
    List<User> getUserList(@RequestBody List<User> users);
}
